Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use netboot.AllowPXE to determine hardware ready status #367

Merged
merged 1 commit into from
May 15, 2024

Conversation

ahreehong
Copy link
Contributor

@ahreehong ahreehong commented May 8, 2024

Description

This PR changes CAPT to look at hardware.Spec.Interfaces[].netboot.AllowPXE to determine if the hardware is ready and gate network booting

Why is this needed

Gating of network booting in Smee now occurs via Hardware.Spec.Interfaces[].Netboot.AllowPXE, so we need to update the logic in CAPT

Fixes: #363

How Has This Been Tested?

Tested manually following these steps:

  1. Provision a cluster with CAPT
  2. Set a machine's firmware to network boot
  3. Reboot the machine

and verified that the machine does not go into network boot after the reboot

Checklist:

I have:

  • updated the documentation and/or roadmap (if required)
  • added unit or e2e tests
  • provided instructions on how to upgrade

@ahreehong ahreehong force-pushed the use-allowpxe branch 2 times, most recently from d49f40b to b630e0d Compare May 8, 2024 18:46
// setting these Metadata.State and Metadata.Instance.State = "" indicates to Boots
// that this hardware should be allowed to netboot. FYI, this is not authoritative.
// setting the AllowPXE=true indicates to Smee that this hardware should be allowed
// to netboot. FYI, this is not authoritative.
// Other hardware values can be set to prohibit netbooting of a machine.
// See this Boots function for the logic around this: https://github.com/tinkerbell/boots/blob/main/job/dhcp.go#L115
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we update the link as well? Thanks.

Comment on lines 216 to 220
for _, ifc := range hw.Spec.Interfaces {
if ifc.Netboot != nil {
ifc.Netboot.AllowPXE = ptr.To(false)
}
}
Copy link
Member

@chrisdoherty4 chrisdoherty4 May 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the caller should be setting this.

patchHardwareStates has no business logic that describes the conditions for assigning false so its peculiar to have it live here. We also previously made the decision in the calling function and I think that's the right level to have the logic because it has sufficient context.

Copy link
Member

@chrisdoherty4 chrisdoherty4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some rejigging. See inline comments.

@chrisdoherty4 chrisdoherty4 added the ready-to-merge Signal to Mergify to merge the PR. label May 15, 2024
@chrisdoherty4 chrisdoherty4 merged commit 5483611 into tinkerbell:main May 15, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Signal to Mergify to merge the PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update how network booting is disabled
2 participants